home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Mac OS 8.5 Updaters / RealPC⁄Soft Windows / SoftWindows / SoftWindows Upgrade Disk / INSIGNIA / PATCHONE.BAT < prev    next >
Encoding:
DOS Batch File  |  1998-08-24  |  3.6 KB  |  101 lines

  1. rem
  2. rem @(#)u.patchone.bat    1.6 03/14/97
  3. rem (c) Insignia Solutions plc, 1997.
  4. rem
  5. rem PATCHONE - Batch file to save copies of files to be patched
  6. rem            and to apply the patch. Takes parameters:
  7. rem
  8. rem      1:    File to be patched. eg. "vtd.386"
  9. rem
  10. rem      2:    Directory containing file. eg. "c:\windows\system"
  11. rem
  12. rem      3..7: Parameters to pass to patch program. eg. "-VTD" or "WIN311"
  13. rem
  14. rem       It uses INSPAT95 to do the patching if it exists and INSPATCH
  15. rem       if it doesn't. Therefore to patch a commpressed VxD library,
  16. rem       such as VMM32.VXD, INSPAT95 should be created before calling
  17. rem       this batch file.
  18.  
  19. echo Patching %2\%1    >>c:\insignia\up.log
  20.  
  21. rem  IMPORTANT: We have a problem with command line lengths - DOS imposes a
  22. rem  128-character limit. To alleviate this we:
  23. rem  (1) change directory to %2 and make copies of the file.
  24. rem  (2) change directory to c:\insignia and leave that off the first three
  25. rem  elements of the inspatch command line and off the log file.
  26.  
  27. set patchone_drive=XX
  28. ibatch patchone_drive string %2 0 2
  29. %patchone_drive%
  30. if not "%2" == "%patchone_drive%" cd %2
  31.  
  32. rem  Ensure directory exists for original copies of files.
  33. rem  Gotcha - cannot use "if exist somepath\nul" on FSA drive!
  34. set patchone_odir=xxxxxxxxxxxxxxxx
  35. dir /b/ad | find "ORIGINAL.SAV" | ibatch patchone_odir string 0 0
  36. if not "%patchone_odir%" == "ORIGINAL.SAV" mkdir original.sav    >>c:\insignia\up.log
  37.  
  38. rem  Save a copy of the very first version of the file we ever see.
  39. rem  If there is an original copy in c:\insignia\old (historical location),
  40. rem  move that into the new location in preference.
  41. if  exist c:\insignia\old\%1 MOVE /Y c:\insignia\old\%1    original.sav\%1    >>c:\insignia\up.log
  42. if not exist original.sav\%1 COPY /Y %1            original.sav\%1    >>c:\insignia\up.log
  43.  
  44. rem Save a copy of the current version of the file.
  45. COPY /Y %1 c:\insignia\PATCH.WRK    >>c:\insignia\up.log
  46.  
  47. rem Cater for the file being read only.
  48. if   "%patchone_drive%" == "C:" goto cdrive
  49. if   "%patchone_drive%" == "c:" goto cdrive
  50.  
  51. rem If the file is on FSA and user is not its owner,
  52. rem we cannot simply execute "attrib -r". We can
  53. rem however move the file to another location on the
  54. rem same drive, where it will remain.
  55. rem The initial set commands just reserves environment space.
  56. set patchone_ro=X
  57. ATTRIB %1 | ibatch patchone_ro string 7 1
  58. if "%patchone_ro%" == "R" move /y %1 original.sav\ro_files\%1    >>c:\insignia\up.log
  59. goto alldrives
  60.  
  61. :cdrive
  62. ATTRIB -R %1                >>c:\insignia\up.log
  63. :alldrives
  64.  
  65. c:
  66. cd \insignia
  67.  
  68. rem  Work out which patcher to use.
  69. rem  Leaving off the ".exe" extension saves another 4 command line characters.
  70. SET INSPATCH=INSPAT95
  71. if not exist INSPAT95.EXE  SET INSPATCH=INSPATCH
  72.  
  73. rem Patch the saved current version of the file.
  74. %INSPATCH% PATCH.PAT PATCH.WRK %2\%1 %3 %4 %5 %6 %7    >>up.log
  75.  
  76. rem Check whether we succeeded.
  77. if exist %2\%1  goto endit
  78.  
  79. rem Record that patching current version failed.
  80. echo Trying %2\original.sav\%1 instead    >>up.log
  81.  
  82. rem Patch the saved original version of the file.
  83. rem  Another measure to save command line length: copy the original file
  84. rem  (which has quite a long path) to patch.wrk in the cd and patch that.
  85. copy /y %2\original.sav\%1 patch.wrk    >>up.log
  86. %INSPATCH% PATCH.PAT patch.wrk %2\%1 %3 %4 %5 %6 %7    >>up.log
  87.  
  88. rem Check whether we succeeded this time.
  89. if exist %2\%1  goto endit
  90.  
  91. rem Restore the current version of the file.
  92. COPY /Y PATCH.WRK %2\%1            >>up.log
  93.  
  94. rem Record that patching failed.
  95. echo Patching %2\%1 failed!        >>up.log
  96. rem ***** Set failure flag here *****
  97.  
  98. :endit
  99. rem Delete the working copy of the file.
  100. DEL PATCH.WRK                >>up.log
  101.